﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NCP.Recruiting.Domain.Aggregates.Candidates;
using System.Data.Entity.ModelConfiguration;

namespace NCP.Recruiting.Repository.SqlServer.UnitOfWork.Mapping
{
    class CandidateEntityTypeConfiguration : EntityTypeConfiguration<Candidate>
    {
        public CandidateEntityTypeConfiguration()
        {
            this.HasKey(c => c.Id);

            this.ToTable("ncp_candidate");
            this.HasRequired(s => s.Resume).WithMany().HasForeignKey(s => s.ResumeId);
            this.HasRequired(s => s.Jobposition).WithMany().HasForeignKey(s => s.JobPositionId);
            this.HasOptional(s => s.Tag).WithMany().HasForeignKey(s => s.TagId);
        }
    }
}
